﻿<div style="background:#fbf9fe" ms-controller="MXXFB">
    <div>
        <div class="weui_cells_title">基本信息</div>
        <div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label label">公告类型</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select ms-duplex="modelData.LeiBie" class="weui-select szhl szhl_require">
                        <option value="">请选择公告类型</option>
                        <option ms-repeat-item="ColumnData" ms-attr-value="item.ID">{{item.TypeName}}</option>
                    </select>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label label">公告标题</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input type="text" placeholder="请填写标题" id="appDate" ms-duplex="modelData.RBDate" class="weui_input szhl szhl_require" />
                </div>
            </div>
            <div class="weui_cells_form">
                <div class="weui_cell">
                    <div class="weui_cell_hd" style="display:none;"><label class="weui_label label">报告内容</label></div>
                    <div class="weui_cell_bd weui_cell_primary">
                        <textarea ms-duplex="modelData.RBContent" rows="3" placeholder="请输入报告内容" class="weui_textarea szhl szhl_require" style="height:180px;"></textarea>
                    </div>
                </div>
            </div>
        </div>
        <div class="weui_cells_title">其他信息</div>

        <div class="weui_cells weui_cells_form">

            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label label">接收人</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input type="text" id="conCSR" placeholder="请选择抄送人" ms-duplex="modelData.ChaoSongUser" class="weui_input szhl szhl_getPeoples" />
                </div>
            </div>
        </div>
        <div class="weui_cells_title">图片上传</div>
        <div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <input type="text" id="upFile" class="wximgupload" style="display:none" ms-duplex="modelData.Files" />
                </div>
            </div>
        </div>
    </div>

</div>




<script>

    var tempmodel = avalon.define({
        $id: "MXXFB",
        name: "信息发布",
        ColumnData: [],
        pageType: "edit",
        tpData: [],
        plData: [],
        plcount: 0,
        dataid: "",
        wximg: "",
        modelData: { "isPL": true, "XXFBType": "", "FBTime": "", "JSUser": "", "IsSecret": true, "Files": "", "JSUser": "", "MsgType": 1, "IsSend": "0", "SHUser": "", "IsSH": false },
        inittemp: function (strId) {

            $.getJSON('/api/Bll/ExeAction?Action=XXFB_GETXXFBBYUSER', {}, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    tempmodel.ColumnData = resultData.Result;

                }
            })


            if (strId) {

                tempmodel.dataid = strId;
                //编辑加载数据
                $.getJSON('/API/VIEWAPI.ashx?Action=GZBG_GETGZBGMODEL', { P1: strId }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        tempmodel.modelData = resultData.Result;

                        tempmodel.plData = resultData.Result1;
                        tempmodel.plcount = resultData.Result1.length;
                        tempmodel.tpData = resultData.Result2;
                        ComFunJS.uploadimgnew(tempmodel.tpData);
                        ComFunJS.viewimg(tempmodel.tpData);
                        if (tempmodel.modelData.RBDate && tempmodel.modelData.RBDate.length > 10) {
                            tempmodel.modelData.RBDate = tempmodel.modelData.RBDate.substring(0, 10);

                            $("#appDate").calendar({
                                value: [tempmodel.modelData.RBDate]
                            });
                        }


                        setTimeout("ComFunJS.initForm()", 500)
                    }
                })
            } else {

                ComFunJS.initForm();
                ComFunJS.uploadimgnew();
            }
        },//初始化
        SaveData: function (callback) {
            if (!tempmodel.modelData.XXFBType) {
                top.ComFunJS.winwarning("请选择公告类型");
                return;
            }
            $("#imglist .tpli").each(function () {
                if ($(this).hasClass("wximg")) { //微信上传未处理的图片
                    if (tempmodel.wximg) {
                        tempmodel.wximg += ",";
                    }
                    tempmodel.wximg += $(this).attr("itemid");

                }
            })
            tempmodel.modelData.IsSend = "1";
         
            $.getJSON("/api/Bll/ExeAction?Action=XXFB_ADDXXFBM&r=" + Math.random(), { P1: JSON.stringify(tempmodel.modelData.$model), P2: tempmodel.wximg }, function (result) {
                return callback.call(this, result);
            });
        },
    });//# sourceURL=MXXFB.js;
</script>